package com.xiaoyi.intentsdklibrary.Utils;


import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MathUtils {
    public static int randomNum(int i, int i2) {
        return (new Random().nextInt(i2) % ((i2 - i) + 1)) + i;
    }

    public static String findIntNum(String str) {
        Matcher matcher = Pattern.compile("[0-9]+").matcher(str);
        return matcher.find() ? matcher.group(0) : "0";
    }

    public static int parseInt(String str) {
        try {
            return Integer.parseInt(str);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            return -11;
        }
    }
}
